#ifndef _GAMEAPP_H
#define _GAMEAPP_H

#include "WinMain.h"
#include "Timer.h"
#include "GameEngine.h"
#include "Sprite.h"
#include "ResourceManager.h"

class GameApp
{
public:
	//--------------------------------------------------------------------------------
	// Construction and Destruction for this class
	//--------------------------------------------------------------------------------
			 GameApp(void);
	virtual ~GameApp(void);

	//--------------------------------------------------------------------------------
	// Public Functions for this class
	// Three important functions of game
	//--------------------------------------------------------------------------------
	static LRESULT CALLBACK		StaticWinProc(HWND, UINT, WPARAM, LPARAM);
	BOOL						GameInit(HINSTANCE);		
	void						GameRun();
	void						GameEnd();

private:
	//--------------------------------------------------------------------------------
	// Private Variables for this class
	//--------------------------------------------------------------------------------

	HWND					m_hWindow;					// Main handle window
	HINSTANCE				m_hInstance;
	Timer				    m_Timer;					// Game timer
	BOOL					m_bLostDevice;				// is the device lost ???
	BOOL					m_bActiveRender;			// Should app render ???

	unsigned short			m_usLastFrameRate;			// Previous FrameRate
	unsigned short			m_usFrameRate;				// Current FrameRate

	LPDIRECT3D9				m_pD3D;						// Direct3D object
	LPDIRECT3DDEVICE9		m_pD3DDevice;				// Direct3D Device object
	LPD3DXSPRITE			m_pSpriterHandler;
	D3DPRESENT_PARAMETERS	m_D3DPresentParams;			// Direct3D Present Parameters
	CGameEngine*			m_gameEngine;
	CSprite*				m_sprite;
	LPDIRECT3DTEXTURE9		m_texture;
	//---------------------------------------------------------
	// Private functions for this class
	//---------------------------------------------------------
	BOOL					InitWindow(HINSTANCE);	
	BOOL					InitDirect3D();
	BOOL					InitResource();
	void					FrameAdvance();

	//--------------------------------------------------------------------------------
	// Private static functions for this class
	//--------------------------------------------------------------------------------
	LRESULT WinProc(HWND, UINT, WPARAM, LPARAM);
		
};

#endif